import { SETCURRENT, TABBERVISIBLE } from '../constants/tabber'

type ActionType = {
    type: String,
    val: number
}

type StateType = {
    current: number,
    visible: boolean
}

const initVal: StateType = {
    current: 0,
    visible: true
}

export default function tabber(state: StateType = initVal, action: ActionType) {
    switch(action.type) {
        case SETCURRENT:
            return {
                ...state,
                current: action.val
            }
        case TABBERVISIBLE:
            return {
                ...state,
                visible: action.val
        }
        default: 
            return state
    }
}